Kotlin Standard Library Cookbook: Master the powerful Kotlin standard library through practical code examples by Samuel Urbanowicz

Kotlin Standard Library Cookbook: Master the powerful Kotlin standard library through practical code examples by Samuel Urbanowicz

Author:Samuel Urbanowicz [Urbanowicz, Samuel]
Language: eng
Format: epub, pdf
Tags: COM051210 - COMPUTERS / Programming / Object Oriented, COM051000 - COMPUTERS / Programming / General, COM051280 - COMPUTERS / Programming Languages / Java
Publisher: Packt Publishing
Published: 2018-07-29T23:00:00+00:00


There's more...

In this recipe, we have created the Client class, which contains immutable val properties. In order to store mutable var properties, we can use a MutableMap instance instead of a read-only Map.

Built-in support for class properties is a powerful feature of the language. It brings awesome possibilities to shape your code in a neat way. You should definitely give it a try when working on a more complex project. For example, you can delegate the properties of your entities to be read and written directly to and from the database. There is also a group of ready-to-use delegates built into the standard library, such as the Lazy or Observable delegates. You can learn more about their application in the next recipes in this chapter. You can explore the full set of built-in delegates in the official standard library docs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.properties/-delegates/index.html.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.